<?php
namespace Data;

class Search
{
    public static function Run($field)
    {
        if (isset($_GET['search'])) {
            if (is_array($field)) {
                foreach ($field as $value) {
                    $search = isset($search) ? "{$search} OR " : "";
                    $search .= "{$value} LIKE '%{$_GET['search']}%'";
                }
            } else {
                $search = "{$field} LIKE '%{$_GET['search']}%'";
            }
            return " AND ($search)";

        }
        return '';
    }
}
